package cn.dong.cms.controller.api;

import cn.dong.cms.domain.Ad;
import cn.dong.cms.service.AdService;
import cn.dong.api.domain.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/cms/ad")
public class ApiAdController {

    @Autowired
    private AdService adService;


    /**
     * 查询这个类型下的所有广告
     * @param id
     * @return
     */
    @GetMapping("/findByTypeId/{id}")
    public CommonResult findByTypeId(@PathVariable String id){
        List<Ad> list = adService.findByTypeId(id);
        return CommonResult.ok().data(list);
    }


}
